<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.util.*"
    import="java.text.*"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<% String datetime = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<%@include file="style.jsp" %>
    <%@include file="script.jsp" %>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/orderlang/distributor/css/message_detail.css"/>
    <title>我的订货郎</title>
</head>
<body onselectstart="return false">
	<div id="container_1" style="height:100%">
	    <div style="position: relative">
	        <%@include file="header.jsp" %>
	    </div>
	    <div id="content" class="clearfix">
	        <%@include file="left_menu.jsp" %>
	        <!--内容部分-->
	        <div class="right-content" style="margin:75px 50px 0 213px;">
	            <p class="brand">
	                <a>客户</a>><a class="now">留言</a>
	            </p>
	            <div class="content">
	                <div class="message-list">
	                    <div class="msg-block">
	                        <h3><span><%=datetime %></span></h3>
	                        <c:forEach items="${messageList}" var="messageList" begin="0" end="19">
	                        	<c:if test="${messageList.isToDistributor == 0}">
			                        <div class="message-item user">
			                            <s class="fl"></s>
			                            <span><fmt:formatDate value="${messageList.createTime}" type="time" pattern="hh:mm"/></span>
			                            <p class="user-name">${messageList.distributorId}</p>
			                            <p class="huifu">${messageList.message}</p>
			                        </div>
		                        </c:if>
		                        <c:if test="${messageList.isToDistributor == 1}">
			                        <div class="message-item">
			                            <s class="fl"></s>
			                            <span><fmt:formatDate value="${messageList.createTime}" type="time"  pattern="hh:mm"/></span>
			                            <p class="user-name">${messageList.customer.name}</p>
			                            <p class="huifu">${messageList.message}</p>
			                        </div>
		                        </c:if>
	                        </c:forEach>
	                    </div>
	                    <form action="${pageContext.request.contextPath}/message/insertMessage" method="post" id="messageInput" onsubmit="return check()">
	                    	<c:forEach items="${messageList}" var="messageList" begin="0" end="0">
		                    <textarea name="message" id="messageInfo" onblur="checkMessage()"></textarea>
		                    <input type="hidden" name="id" value="${messageList.id}">
		                    <button>回复</button>
		                    </c:forEach>
	                    </form>
	                </div>
	            </div>
	        </div>
	        <script src="${pageContext.request.contextPath}/static/orderlang/distributor/js/message_detail.js"></script>
	        <!--内容部分结束-->
	    </div>
	</div>

</body>
</html>